package builder.AssetFormBuilderPackage;

import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JLabel;

import builder.FormBuilder;

import form.FormLabel;
import form.AssetForm.AssetForm;

public class ViewAssetFormBuilder extends FormBuilder{

	GridBagConstraints c = new GridBagConstraints();
	
	public ViewAssetFormBuilder(){
		super(new AssetForm());
	}

	@Override
	public void setFormSettings() {
		form.setLayout(new GridBagLayout());
		
	}

	@Override
	public void buildComponents() {
		AssetForm assetForm = (AssetForm) form;
		
		buildName(assetForm);
		buildOwner(assetForm);
		buildCustodian(assetForm);
		buildStorageLocation(assetForm);
		buildDateAcquired(assetForm);
		buildRententionPeriod(assetForm);
		buildType(assetForm);
		buildMaintainance(assetForm);
		buildClassification(assetForm);
		buildValue(assetForm);
		buildFinancial(assetForm);
		buildConfidentiality(assetForm);
		buildIntegrity(assetForm);
		buildAvailability(assetForm);
		
	}



	public void buildName(AssetForm assetForm) {
		JLabel txtName = new JLabel();
		txtName.setFont(new Font("Tahoma", Font.BOLD, 12));
		FormLabel nameL = new FormLabel("Name: ", txtName, null);
		assetForm.setAssetName(nameL);
		c.anchor = GridBagConstraints.WEST;
		c.gridx = 0;
		c.gridy = 1;
		assetForm.add(nameL, c);
	}
	
	public void buildOwner(AssetForm assetForm) {
		JLabel txtOwner = new JLabel();
		txtOwner.setFont(new Font("Tahoma", Font.BOLD, 12));
		FormLabel ownerL = new FormLabel("Owner: ", txtOwner, null);
		assetForm.setOwner(ownerL);
		c.gridx = 0;
		c.gridy = 2;
		assetForm.add(ownerL, c);	
	}
	
	public void buildCustodian(AssetForm assetForm) {
		JLabel txtCustodian = new JLabel();
		txtCustodian.setFont(new Font("Tahoma", Font.BOLD, 12));
		FormLabel custodianL = new FormLabel("Custodian: ", txtCustodian, null);
		assetForm.setCustodian(custodianL);
		c.gridx = 0;
		c.gridy = 3;
		assetForm.add(custodianL, c);	
	}

	public void buildStorageLocation(AssetForm assetForm) {
		JLabel txtStorageLocation = new JLabel();
		txtStorageLocation.setFont(new Font("Tahoma", Font.BOLD, 12));
		FormLabel storageLocationL = new FormLabel("Storage Location: ", txtStorageLocation, null);
		assetForm.setStorageLocation(storageLocationL);
		c.gridx = 0;
		c.gridy = 4;
		assetForm.add(storageLocationL, c);		
	}
	
	public void buildDateAcquired(AssetForm assetForm) {
		JLabel txtDateAcquired = new JLabel("");
		txtDateAcquired.setFont(new Font("Tahoma", Font.BOLD, 12));
		FormLabel dateAcquiredL = new FormLabel("Date Acquired: ", txtDateAcquired, null);
		assetForm.setDateAcquired(dateAcquiredL);
		c.gridx = 0;
		c.gridy = 5;
		assetForm.add(dateAcquiredL, c);
	}
	
	public void buildRententionPeriod(AssetForm assetForm) {
		JLabel txtRetentionPeriod = new JLabel("");
		txtRetentionPeriod.setFont(new Font("Tahoma", Font.BOLD, 12));
		FormLabel retentionPeriodL = new FormLabel("Retention Period: ", txtRetentionPeriod, null);
		assetForm.setRetentionPeriod(retentionPeriodL);
		c.gridx = 0;
		c.gridy = 6;
		assetForm.add(retentionPeriodL, c);
	}
	
	public void buildType(AssetForm assetForm) {
		JLabel txtType = new JLabel();
		txtType.setFont(new Font("Tahoma", Font.BOLD, 12));
		FormLabel typeL = new FormLabel("Type: ", txtType, null);
		assetForm.setType(typeL);
		c.gridx = 1;
		c.gridy = 1;
		assetForm.add(typeL, c);	
	}
	
	public void buildMaintainance(AssetForm assetForm) {
		JLabel txtMaintenance = new JLabel();
		txtMaintenance.setFont(new Font("Tahoma", Font.BOLD, 12));
		FormLabel maintenanceL = new FormLabel("Maintenance Schedule: ", txtMaintenance, null);
		assetForm.setMaintenanceSched(maintenanceL);
		c.gridx = 1;
		c.gridy = 2;
		assetForm.add(maintenanceL, c);
	}
	
	public void buildClassification(AssetForm assetForm) {
		JLabel txtClassification = new JLabel();
		txtClassification.setFont(new Font("Tahoma", Font.BOLD, 12));
		FormLabel classificationL = new FormLabel("Classification: ", txtClassification, null);
		assetForm.setClassification(classificationL);
		c.gridx = 1;
		c.gridy = 3;
		assetForm.add(classificationL, c);
	}
	
	public void buildValue(AssetForm assetForm) {
		JLabel txtValue = new JLabel("Value: ");
		txtValue.setFont(new Font("Tahoma", Font.BOLD, 15));
		c.gridx = 1;
		c.gridy = 4;
		assetForm.add(txtValue, c);
	}
	
	public void buildFinancial(AssetForm assetForm) {
		JLabel txtFinancial = new JLabel();
		txtFinancial.setFont(new Font("Tahoma", Font.BOLD, 12));
		FormLabel financialL = new FormLabel("Financial: ", txtFinancial, null);
		assetForm.setFinancialVal(financialL);
		c.gridx = 1;
		c.gridy = 5;
		assetForm.add(financialL, c);
	}
	
	public void buildConfidentiality(AssetForm assetForm) {
		JLabel txtConfidentiality = new JLabel();
		txtConfidentiality.setFont(new Font("Tahoma", Font.BOLD, 12));
		FormLabel confidentialityL = new FormLabel("Confidentiality: ", txtConfidentiality, null);
		assetForm.setConfidentialityVal(confidentialityL);
		c.gridx = 1;
		c.gridy = 6;
		assetForm.add(confidentialityL, c);
	}
	
	public void buildIntegrity(AssetForm assetForm) {
		JLabel txtIntegrity = new JLabel();
		txtIntegrity.setFont(new Font("Tahoma", Font.BOLD, 12));
		FormLabel integrityL = new FormLabel("Integrity: ", txtIntegrity, null);
		assetForm.setIntegrityVal(integrityL);
		c.gridx = 1;
		c.gridy = 7;
		assetForm.add(integrityL, c);
	}
	
	public void buildAvailability(AssetForm assetForm) {
		JLabel txtAvailability = new JLabel();
		txtAvailability.setFont(new Font("Tahoma", Font.BOLD, 12));
		FormLabel availabilityL = new FormLabel("Availability: ", txtAvailability, null);
		assetForm.setAvailabilityVal(availabilityL);
		c.gridx = 1;
		c.gridy = 8;
		assetForm.add(availabilityL, c);
	}

}
